#ifndef LINKAGE_H
#define LINKAGE_H
#include <cstdio>
#include <cstdlib>
#include <string>
#include <map>
#include <set>
#include <iostream>
#include <stdint.h>

typedef int32_t family_id_t;
typedef int32_t individual_id_t;
typedef int32_t phenotype_t;

enum Gender
	{
	gender_unknown=0,
	gender_male=1,
	gender_female=2
	};

class Individual;
class Family;


class Family
	{
	public:
		family_id_t id;
		std::string name;
		std::map<std::string,Individual*> name2individual;
		std::map<individual_id_t,Individual*> id2individual;
	
		Family(family_id_t id, std::string name);
		~Family();
		Individual* findIndividualById(individual_id_t indi);
		Individual* findIndividualByName(const std::string name);
		void put(Individual* indi);
	};
typedef Family* FamilyPtr;

std::ostream& operator<<(std::ostream& out,const Family& o);

class Individual
	{
	public:
		individual_id_t id;
		Family* family;
		std::string name;
		std::string father;
		std::string mother;
		Gender gender;
		phenotype_t status;
	
		Individual(individual_id_t id,
			Family* family,
			std::string name,
			std::string father,
			std::string mother,
			Gender gender,
			phenotype_t status
			);
		~Individual();

	};
typedef Individual* IndividualPtr;

std::ostream& operator<<(std::ostream& out,const Individual& o);

#endif
